#include "StartingMenu.h"
#include "StringUtilities.h"
#include "PrintUtilities.h"
#include "MenuManager.h"
#include "GameControls.h"

StartingMenu::StartingMenu(MenuManager* const i_menuManager)
	: Menu(i_menuManager)
	, m_continueGame(false)
{
}

void StartingMenu::Draw() const
{
	STL::string text;

	if (m_continueGame)
	{
		text =	" 1) Play a new game.\n" 
				" 2) Load saved game.\n" 
				" 3) Continue.\n" 
				" \n" 
				" 0) Exit from game.";
	}
	else
	{
		text =	" 1) Play a new game.\n" 
				" 2) Load saved game.\n" 
				" \n" 
				" 0) Exit from game.";
	}

	STD::cout	<< Print::Title(" -WELCOME TO ZALCETTO!-")
				<< Print::Options(text)
				<< " Selection: ";
}

bool StartingMenu::Input(const STL::string& i_input)
{
	bool goodInput = true;

	int res = Utilities::StringToInt(i_input);

	switch (res)
	{
	case 1:
		GetMM()->GetGameControls()->Restart();
		GetMM()->PushMenu(GetMM()->GetMainMenu());
		break;

	case 2:
		GetMM()->PushMenu(GetMM()->GetLoadMenu());
		break;

	case 3:
		if (m_continueGame)
			GetMM()->PushMenu(GetMM()->GetMainMenu());
		else 
			goodInput = false;
		break;

	case 0:
		GetMM()->GetGameControls()->Quit();
		break;

	default:
		goodInput = false;
	}
	return goodInput;
}

